/*
 * File: StoneMasonKarel.java
 * --------------------------
 * The StoneMasonKarel subclass as it appears here does nothing.
 * When you finish writing it, it should solve the "repair the quad"
 * problem from Assignment 1.  In addition to editing the program,
 * you should be sure to edit this comment so that it no longer
 * indicates that the program does nothing.
 */

import stanford.karel.*;

public class StoneMasonKarel extends SuperKarel {

	public void run() {

		boolean nextColumn = true;
		do {
			turnLeft();
			if (!this.beepersPresent()) {
				this.putBeeper();
			}
			// go top
			while (this.frontIsClear()) {
				move();
				if (!this.beepersPresent()) {
					this.putBeeper();
				}
			}
			// go down
			turnAround();
			while (this.frontIsClear()) {
				move();
			}
			turnLeft();

			if (this.frontIsBlocked()) {
				nextColumn = false;
			} else {
				move();move();move();move();
			}

		} while (nextColumn);

	}
}
